import request from "@/utils/request";

// 获取样本集树
export const getSampleTreeApi = (params) => {
  return request({
    url: "/sample/category/getSampleTree",
    method: "GET",
    params,
  });
};

// 新增样本集分类接口
export const addSampleTreeApi = (data) => {
  return request({
    url: "/sample/category",
    method: "POST",
    data,
  });
};

// 删除样本集分类接口
export const deleteSampleTreeApi = (ids, sampleSetType) => {
  return request({
    url: `/sample/category/${sampleSetType}/${ids}`,
    method: "DELETE",
  });
};

// 修改样本集分类接口
export const updateSampleTreeApi = (data) => {
  return request({
    url: "/sample/category",
    method: "PUT",
    data,
  });
};

// 移动样本集树某个节点
export const moveSampleTreeApi = (data) => {
  return request({
    url: "/sample/category/moveSampleTree",
    method: "POST",
    data,
  });
};

// 感知样本数据列表
export const getPerceptionSampleApi = (params) => {
  return request({
    url: "/sample/perception/list",
    method: "GET",
    params,
  });
};

// 感知样本数据详情
export const getPerceptionSampleDetailsApi = (id) => {
  return request({
    url: `/sample/perception/${id}`,
    method: "GET",
  });
};

// 新增感知样本接口
export const addPerceptionSampleApi = (data) => {
  return request({
    url: "/sample/perception",
    method: "POST",
    data,
  });
};

// 删除感知样本接口
export const deletePerceptionSampleApi = (ids) => {
  return request({
    url: `/sample/perception/${ids}`,
    method: "DELETE",
  });
};

// 修改感知样本接口
export const editPerceptionSampleApi = (data) => {
  return request({
    url: "/sample/perception",
    method: "PUT",
    data,
  });
};

export const downloadPerceptionSampleApi = (params) => {
  return request({
    url: "/sample/perception/download",
    method: "GET",
    params,
    responseType: "blob",
    timeout: 60000,
  });
};

// 辅助决策样本数据详情
export const getDecisionSampleDetailsApi = (sampleSetId) => {
  return request({
    url: `/sample/decision/getInfoBySampleSetId?sampleSetId=` + sampleSetId,
    method: "GET"
  });
};

// 修改辅助决策样本
export const editDecisionSampleApi = (data) => {
  return request({
    url: "/sample/decision",
    method: "PUT",
    data,
  });
};

// 删除辅助决策样本
export const deleteDecisionSampleApi = (ids) => {
  return request({
    url: `/sample/decision/${ids}`,
    method: "DELETE",
  });
};


// 辅助决策样本数据文件列表
export const getDecisionSampleApi = (params) => {
  return request({
    url: `/sample/decisionFile/list`,
    method: "GET",
    params
  });
};

// 辅助决策样本数据引接文件保存
export const addDecisionFileApi = (data) => {
  return request({
    url: "/sample/decisionFile/batchAdd",
    method: "POST",
    data,
  });
};

// 删除辅助决策样本文件
export const deleteDecisionFileApi = (ids) => {
  return request({
    url: `/sample/decisionFile/${ids}`,
    method: "DELETE",
  });
};
// 删除辅助决策样本子集文件
export const deleteDecisionSonFileApi = (data) => {
  return request({
    url: `/sample/decisionFile/deleteSubsetFiles`,
    method: "POST",
    data
  });
};
// 下载决策样本数据文件列表
export const getDecisionFileDownloadApi = (filePath) => {
  return request({
    url: `/sample/decisionFile/download?filePath=` + filePath,
    method: "GET",
    responseType: "blob",
    timeout: 60000,
  });
};
// 辅助决策样本开启子集构建
export const editDecisionStartApi = (id) => {
  return request({
    url: "/sample/decision/startSubsetPod/" + id,
    method: "GET",
  });
};

// 辅助决策样本关闭子集构建
export const editDecisionCloseApi = (id) => {
  return request({
    url: "/sample/decision/closeSubsetPod/" + id,
    method: "GET",
  });
};

// 辅助决策样本在线编辑
export const editDecisionOnilonApi = (id) => {
  return request({
    url: "/sample/decision/getSubsetPodUrl/" + id,
    method: "GET",
  });
};

// 辅助决策样本导出
export const downloadFileSampleApi = (params) => {
  return request({
    url: "/sample/category/exportFileData",
    method: "GET",
    params,
    responseType: "blob",
    timeout: 60000,
  });
};